{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
    <h3 class="pb-3">编辑设备管理</h3>
    <table class="layui-table layui-table-form">
        <tr>
            <td class="layui-td-gray-2">设备名称</td>
            <td>
                <input type="text" name="device_name" value="{$detail.device_name}" autocomplete="off" placeholder="请输入设备名称" class="layui-input">
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray-2">选择售酒端</td>
            <td>
                <select name="user_one">
                    <option value="">售酒端</option>
                    {volist name="$userOneList" id="v"}
                    <option value="{$v.id}" {eq name="$v.id" value="$detail.user_one"}selected{/eq}>{$v.user_name}</option>
                    {/volist}
                </select>
			</td>
        </tr>
		<tr>
			<td class="layui-td-gray-2">补酒员</td>
			<td>
                <select name="user_three">
                    <option value="">选择补酒员</option>
                    {volist name="$userThreeList" id="vv"}
                    <option value="{$vv.id}" {eq name="$vv.id" value="$detail.user_three"}selected{/eq}>{$vv.user_name}</option>
                    {/volist}
                </select>
			</td>
		</tr>
        <tr>
            <td class="layui-td-gray-2">售酒类型</td>
            <td>
                <select name="cate_id">
                    <option value="">选择类型</option>
                    {volist name="$cateList" id="vo"}
                    <option value="{$vo.id}" {eq name="$vo.id" value="$detail.cate_id"}selected{/eq}>{$vo.title}</option>
                    {/volist}
                </select>
            </td>
        </tr>
        <tr>
            <td class="layui-td-gray-2">详情描述</td>
            <td>
                <textarea name="content" class="layui-textarea" placeholder="请输入设备详情描述">{$detail.content}</textarea>
            </td>
        </tr>
    </table>
    <div class="py-3">
        <input type="hidden" name="id" value="{$detail.id}"/>
        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
    var moduleInit = ['tool'];

    function gouguInit() {
        var form = layui.form, tool = layui.tool;
        var layer = layui.layer;
        var element = layui.element;


        //监听提交
        form.on('submit(webform)', function (data) {
            layer.load();
            let callback = function (e) {
                layer.msg(e.msg);
                if (e.code == 0) {
                    tool.sideClose(1000);
                }
            }
            tool.post("/admin/device/edit", data.field, callback);
            return false;
        });
    }
</script>
{/block}
<!-- /脚本 -->